//
//  NSString+colorString.m
//  ,,
//
//  Created by AShe on 2017/11/9.
//  Copyright © 2017年 gongyouzhijia. All rights reserved.
//

#import "NSString+colorString.h"


@implementation NSString (colorWithString)

+ (NSMutableAttributedString *)ls_changeCorlorWithColor:(UIColor *)color TotalString:(NSString *)totalStr SubStringArray:(NSArray *)subArray {
    
    NSMutableAttributedString *attributedStr = [[NSMutableAttributedString alloc] initWithString:totalStr];
    for (NSString *rangeStr in subArray) {
        
        NSRange range = [totalStr rangeOfString:rangeStr options:NSBackwardsSearch];
        [attributedStr addAttribute:NSForegroundColorAttributeName value:color range:range];
    }
    
    return attributedStr;
}

@end
